#ifndef DBUSOBJMODEL_HPP
#define DBUSOBJMODEL_HPP

#include <QAbstractItemModel>

#include "common.hpp"
struct QDBusObject;
class DbusObjModel : public QAbstractItemModel
{
    Q_OBJECT
public:
    explicit DbusObjModel(QObject *parent = nullptr);
    void refresh(QString context);
    void append(QDBusObject *item,const QModelIndex &index = QModelIndex());
    void append(const QString &bname,const QString &bservice,const QString &bPath,const QString &bInterface);
    void remove(int position,const QModelIndex &index = QModelIndex());
    BusSignatureEx getItemData(const QModelIndex &index);
    QByteArray toContext();
signals:

public slots:

    // QAbstractItemModel interface
public:
    QModelIndex index(int row, int column, const QModelIndex &parent) const override;
    QModelIndex parent(const QModelIndex &child) const override;
    int rowCount(const QModelIndex &parent) const override;
    int columnCount(const QModelIndex &parent) const override;
    QVariant data(const QModelIndex &index, int role) const override;
    QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
private:
    QDBusObject *root;

};












#endif // DBUSOBJMODEL_HPP
